package com.xh.demo.domain.vo;

import com.xh.demo.common.message.ICommonMessage;
import lombok.Getter;

/**
 * @Name ExceptionResult
 * @Description
 * @Author wen
 * @Date 2019-08-01
 */
@Getter
public class ExceptionResult implements ICommonMessage {

    private int code;

    private String msg;

    public ExceptionResult(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static ExceptionResult build(int code, String msg){
        return new ExceptionResult(code, msg);
    }

    public static ExceptionResult build(ICommonMessage cm){
        return build(cm.getCode(), cm.getMsg());
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }

}
